home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr46
/
unchain2.zip
/
UNCHAIN.DOC
< prev
next >
Wrap
Text File
|
1993-06-01
|
9KB
|
282 lines
══════════════════════════════════════════════════════════════════════════
UNCHAIN Planar VGA Mode 13h Enforcer
v2.1 June 1, 1993
Copyright 1993 Colin Buckley. All Rights Reserved.
Use or distribute freely in any environment. In other words, it's FreeWare
══════════════════════════════════════════════════════════════════════════
Introduction
════════════
Borland development tools will only remember which video mode you are
in, it doesn't save any possible video card register changes you might have
made.
There is a great deal of hype over "Mode X", but if you don't own
a secondary video card (monochrome), it's impossible to debug in a Borland
IDE.
I asked if someone had written a program like this on rec.games.programmer
a Usenet newsgroup, and was ignored. It surprised me because every 2nd message
is regarding "Mode X".
I wrote UNCHAIN v1.O that only forced 320x200x256x4. It was the only
mode I used, and no one else seemed interested in it anyways. I was just
going to keep it for myself, but I thought what the hell and posted the
source in r.g.p.
UNCHAIN v2.O should support all Planar VGA modes in the various resolutions,
but since I only use 320x200, they have not been tested at all. I've also
added Palette saving and restoring, and viewing of video pages.
It is all completely transparent to the user, only the viewing of video
pages is interactive as it should be.
UNCHAIN can also restore your palette. Palette restoring works
indepentently of the VGA register savings, so you can use UNCHAIN to restore
the palette in regular Mode 13h aswell.
This is v2.1, the help screen was updated, some minor bugs were fixed,
memory resizing is dynamic, a reset command was added, palette saving/restoring
now affecting colour 255, palette saving/restoring works for regular Mode 13h,
Video page viewing corrected, the keyboard ISR fixed, and the documentation was
heavily updated.
Usage
═════
UNCHAIN requires <3K of memory.
If you use...
>TD YourGame.EXE <YourGame commandline options>
then use...
>UNCHAIN TD.EXE YourGame.EXE <YourGame commandline options>
Note the addition of the extension for TD. If TD.EXE is not in the
current directory, you will have to use the entire filename, such as...
>UNCHAIN C:\TD\TD.EXE YourGame.EXE <YourGame commandline options>
UNCHAIN will spawn TD and Turbo Debugger will load your game and operate
as usual.
You must add some assembler instructions in order for this program to
work transparently. If the instructions are not present, the program
will act like it was not loaded.
If you are unfamiliar with assembler, in Pascal use..
ASM
Assembler Instructions
End;
In C use...
asm{
Assembler Instructions
}
After you have entered Mode 13h and modified the VGA registers, use the
following code...
MOV AX,0CB00h
INT 10h
The above code is the only really necessary instructions. You do not
have to add the following instructions unless you want the following features
aswell.
To reset the VGA registers saved by the above command, use the following
code...
MOV AX,0CB06h
INT 10h
The purpose of this command is to allow you to use Mode 13h and unchained
modes together. Place the above code before you enter Mode 13h, so
UNCHAIN doesn't restore the VGA registers. If you use multiple resolutions
in your program, then it would be wise to use the above code before you
enter each one, but not necessary.
Every time you set the palette use the following code..
MOV AX,0CB05h
INT 10h
If you do Screen Fades then they will run at half speed because UNCHAIN
gets the palette everytime, assuming you add the above code to your SetPalette
routine and it is called by your screen fade. They will work at full speed
when UNCHAIN is not loaded.
I only use one palette per game, so I actually use the above code
as part of the game after I set the palette. It's not part of the SetPalette
code, so I can avoid the fade slow down problem.
Palette restoring works indepentently of the VGA register savings, so
you can use UNCHAIN to restore the palette in regular Mode 13h aswell.
In order to view Video Pages, you must tell UNCHAIN the offsets of upto 4
pages, then while looking at the USER SCREEN (ALT-F5), you may press CTRL-1
for Page 1, CTRL-2 for Page 2, CTRL-3 for Page 3, CTRL-4 for Page 4.
To tell UNCHAIN what offset Page 1 is at use the following code..
MOV BX,Page1Offset
MOV AX,0CB01h
INT 10h
To tell UNCHAIN what offset Page 2 is at use the following code..
MOV BX,Page2Offset
MOV AX,0CB02h
INT 10h
To tell UNCHAIN what offset Page 3 is at use the following code..
MOV BX,Page3Offset
MOV AX,0CB03h
INT 10h
To tell UNCHAIN what offset Page 4 is at use the following code..
MOV BX,Page4Offset
MOV AX,0CB04h
INT 10h
The following default offsets are set until you change them.
Page 1 defaults to offset 0000 (Page 1 in 320x200)
Page 2 defaults to offset 16000 (Page 2 in 320x200)
Page 3 defaults to offset 32000 (Page 3 in 320x200)
Page 4 defaults to offset 48000 (Page 4 in 320x200)
*********************************************************************
IMPORTANT: DO NOT PRESS CTRL-x UNLESS YOU ARE VIEWING THE USER SCREEN
*********************************************************************
If you use a library, it would be best to add the code directly to
the library routines so it's always set up correctly. If UNCHAIN is not
loaded the added instructions should do absolutely nothing.
**************************************************************************
NOTE: I HAVE NOT CHECKED THE INTERRUPT LIST IF AH=CB INT 10h DOES ANYTHING
**************************************************************************
Applications that Work
══════════════════════
I have only tested UNCHAIN with the following programs, and it works
perfectly. There is no screen corruption at all.
Turbo Debugger v3.2: Graphics Save = On
Display Method = Swap Pages
Turbo Profiler v2.2: Graphics Save = On
Display Method = Swap Pages
Turbo Pascal v6: Graphics Save = On
Borland Pascal v7: Graphics Save = On
For TD and TPROF it would be wise to save your setup as the default config
file, rather then updating an EXE, so that all the TD and TPROF incarnations
will be setup correctly.
Please report all applications that work with UNCHAIN to me so I can
update this list. Please include the options necessary for it to work.
My address is at the end of this file.
Problems
════════
Problem:
UNCHAIN reports "Error: Can not execute file!"
Solution:
COMMAND.COM is not executing the file, rather UNCHAIN is spawning it.
Therefore you must specify the extension of the file you wish to execute,
along with the entire path to the file, if it is not in the current directory.
For example...
If you use...
>TD YourGame.EXE <YourGame commandline options>
...and TD.EXE is in your path as being in C:\TD, you will have to use...
>UNCHAIN C:\TD\TD.EXE YourGame.EXE <YourGame commandline options>
...unless it is in the current directory, in which case...
>UNCHAIN TD.EXE YourGame.EXE <YourGame commandline options>
...is fine.
Problem:
UNCHAIN is running but there are 4-16 smaller screens instead of the regular
full screen.
Solution:
UNCHAIN can not remove Chain 4 from Mode 13h, because you haven't added the
assembler instructions to your code that UNCHAIN needs to operate transparently.
Problem:
UNCHAIN is running, I see the regular full screen, but portions of the
screen become corrupt.
Solution:
Change the display method the application UNCHAIN is spawning to use Swap
Pages (which saves and restores the text screen to conventional memory, rather
then VGA display memory) and set Graphics Save to On. The Borland applications
I run have display methods as a configuration option, with the exception
of Borland Pascal, but it's method is still UNCHAIN friendly.
If you're not using a Borland application, play around with the display
methods, if that is not an option, or you still can't correct the screen,
you'll have to live with it.
Credits
═══════
The Planar Mode set routines were influenced by Themie's XLIB,
who based his on Michael Abrash's, who got his from public domain code courtesy
of John Bridges.
The Video Page display routine was taken from John Slagel's XBLT as it
used Display Enable.
Everything else was pieced together from various code I had written in
the past.
Colin Buckley
Toronto, Ontario, Canada.
colin.buckley@rose.com (or route me on RIME at Node 1047 in GameDesign)
══════════════════════════════════════════════════════════════════════════